From: Domas Mituzas Date: Thu, 10 Jun 2004 13:03:37 +0000 (+0000) Subject: Use DatabaseFunctions layer instead of copy-paste one :) X-Git-Tag: 1.5.0alpha1~2942 X-Git-Url: http://git.cyclocoop.org/%22.%24info%5B?a=commitdiff_plain;h=bb3591224020e35a20b19dff3e5762bb29e96006;p=lhc%2Fweb%2Fwiklou.git Use DatabaseFunctions layer instead of copy-paste one :) --- diff --git a/includes/ObjectCache.php b/includes/ObjectCache.php index 00864c6b16..30c5e0b536 100644 --- a/includes/ObjectCache.php +++ b/includes/ObjectCache.php @@ -1,4 +1,6 @@ # http://www.mediawiki.org/ # @@ -114,7 +116,7 @@ class /* abstract */ BagOStuff { function _debug($text) { if($this->debugmode) - echo "\ndebug: $text\n"; + wfDebug("BagOStuff debug: $text\n"); } } @@ -208,7 +210,7 @@ class /* abstract */ SqlBagOStuff extends BagOStuff { } $this->delete( $key ); $this->_query( - "INSERT INTO $0 (keyname,value,exptime) VALUES('$1','$2',$exp)", + "INSERT INTO $0 (keyname,value,exptime) VALUES('$1','$2','$exp')", $key, serialize(&$value)); return true; /* ? */ } @@ -278,42 +280,27 @@ class /* abstract */ SqlBagOStuff extends BagOStuff { } } -class MysqlBagOStuff extends SqlBagOStuff { +class MediaWikiBagOStuff extends SqlBagOStuff { function _doquery($sql) { - return mysql_query($sql); + return wfQuery($sql, DB_READ, "MediaWikiBagOStuff:_doquery"); } function _fetchrow($result) { - return mysql_fetch_array($result); + return wfFetchRow($result); } function _freeresult($result) { - return mysql_free_result($result); + return wfFreeResult($result); } function _dberror($result) { - if($result) - return mysql_error($result); - else - return mysql_error(); + return wfLastError(); } - function _maxdatetime() { - return "'9999-12-31 12:59:59'"; + return "9999-12-31 12:59:59"; } - function _fromunixtime($ts) { - return "FROM_UNIXTIME($ts)"; + return gmdate( "Y-m-d H:i:s", $ts ); } - function _strencode($s) { - return mysql_escape_string($s); - } -} - -class MediaWikiBagOStuff extends MysqlBagOStuff { - function _doquery($sql) { - return wfQuery($sql, DB_READ, "MediaWikiBagOStuff:_doquery"); - } - function _freeresult($result) { - return wfFreeResult($result); + return wfStrEncode($s); } }